
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<%@ include file="/include/head.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/servicePro/jquery.uploadify.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/resources/servicePro/uploadify.css">
<script type="text/javascript">
      
function querypic(id){
 	<%--window.location.href="<%=request.getContextPath()%>/back/student/querypic.do?name=8&schoolId="+id;--%>
	window.open("<%=request.getContextPath()%>/back/student/querypic1.do?name=8&schoolId="+id,'querypic','left=200,top=150,width=900,height=500,titlebar=no,location=no');
 }
   </script>
<title>作品列表</title>


</head>
<body  >
	<div class="container">
		<div class="main_top">

			<div class="main_right fr span10">

				<div class="box pl5">
					<div class="box_border">
						<div class="box_top">
							<div class="box_top_l fl">
								<b class="pl15">数据</b>
							</div>
						</div>
						<div class="searchDiv fl">

							<b>活动列表</b>
							<select id="select-activityId" class="input-text_popup_form"  style="width:300px" maxlength="150" onchange="activitySearch();" >
								<option value="0">全部</option>
								<c:forEach items="${activities}" var="activity" varStatus="abc">
									<c:if test="${activity.ploy_id == ployId}">
										<option value="${activity.ploy_id}" selected>${activity.ploy_name}</option>
									</c:if>
									<c:if test="${activity.ploy_id != ployId}">
										<option value="${activity.ploy_id}" >${activity.ploy_name}</option>
									</c:if>
								</c:forEach>
							</select>
							<%--<input type="submit" value="搜索" class="btn btn82 btn_search">--%>

						</div>
						<div class="box_center">
					<%-- <form id="form1" method="post" action="<%=request.getContextPath()%>/back/actBack/getActivityBeans.do">
								<div class="searchDiv fl">
						
									<b>请输入发布人姓名或活动名称进行搜索</b>
									 <input type="text" name="findkey" class="input-text lh30" style="width:300px" maxlength="50" value="${findkey }">  
									<b>创建时间：</b>
									<input type="text" onclick="WdatePicker();" id="fromDateInput" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'toDateInput\')}', minDate:'#F{$dp.$D(\'toDateInput\',{M:-2})}'})"
										class="Wdate" style="width:150px;padding-left:3px;"
										name="startTime"
										value="${startTime}" />&nbsp;&nbsp;&nbsp;至&nbsp;&nbsp;&nbsp;
										<input type="text" onclick="WdatePicker();" id="fromDateInput" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'toDateInput\')}', minDate:'#F{$dp.$D(\'toDateInput\',{M:-2})}'})"
										class="Wdate" style="width:150px;padding-left:3px;"
										name="endTime"
										value="${endTime}" />
									
									 <input type="submit" value="搜索" class="btn btn82 btn_search">

								</div>
						
							</form>
					
								<div class="searchDiv fr">
								<input type="button"  id="add_manager"  class="new_btn new_btn_publish new_btn_big" 
											value="发布活动">
									    
								</div> --%>
							<div id="table" class=" fl mt10">
								<div class="box span10 oh">
									<table width="100%" border="0" cellpadding="0" cellspacing="0"
										class="list_table">
										<tr>
											<th width="1%">序号</th>
											<!-- <th width="3%">作品名称</th> -->
											<th width="2%">缩略图</th>
											<th width="2%">发布人</th>
											<th width="2%">发布人学校</th>
											<th width="4%">参与活动</th>
											<th width="2%">活动发布人</th>
											<th width="2%">是否有效</th>
											<th width="2%" data-sort_v="${sort_v}">点赞数量</th>
											<th width="2%">获奖名称</th>
											<th width="2%">获奖积分</th>
											<th width="3%">作品发布时间</th>
											<th width="5%">操作</th>
										</tr>
										<c:if test="${fn:length(worksBeans)==0}"><tr class="tr"><td align="center" colspan="9">暂无数据</td> </tr></c:if>
										<c:if test="${fn:length(worksBeans)>0}">
										<c:forEach items="${worksBeans}" var="activity" varStatus="abc">
											<tr class="tr">
											    <td align="center"><c:out value="${(PageBean.currentpage-1)*PageBean.pagesize+abc.index + 1}" /></td>
												<%-- <td align="center"><c:out value="${activity.name}" /></td> --%>
												<td align="center">
                                                 <a href="<%=imgPath %>${activity.picBig}" data-lightbox="image-1" id="showImg" > <IMG alt="活动缩略图" width="50" height="50" src="<%=imgPath %>${activity.picSmall}"/></a>
                                                 </td>
                                                 <td align="center"><c:out value="${activity.user}" /></td>
												<td align="center"><c:out value="${activity.schoolName}" /></td>
												<td align="center"><c:out value="${activity.activity}" /></td>
												<td align="center"><c:out value="${activity.activityUser}" /></td>
												<td align="center">
												  <c:if test="${activity.isUse == '0' }">无效</c:if>
												  <c:if test="${activity.isUse == '1' }">有效</c:if>
												</td>
												<td align="center"><c:out value="${activity.goodsCount}" /></td>
												<td align="center"><c:out value="${activity.honorsName}" /></td>
												<td align="center"><c:out value="${activity.honorsScore}" /></td>
												<td align="center"><c:out value="${activity.time}" /></td>
												<td align="center">
												 <c:if test="${activity.isUse == '0' }"><input type="button"  onclick="window.location.href='<%=request.getContextPath()%>/back/actBack/changeState.do?id=${activity.id}&state=1'" class="new_btn new_btn_up" value="启用"  ></c:if>
												  <c:if test="${activity.isUse == '1' }"><input type="button" onclick="window.location.href='<%=request.getContextPath()%>/back/actBack/changeState.do?id=${activity.id}&state=0'" class="new_btn new_btn_up" value="停用"  ></c:if>
												    <input type="button" class="new_btn new_btn_up" onclick="querypic('${activity.id}')" value="查看图片">
												  </td>
											</tr>
										</c:forEach>
                                     </c:if>
									</table>
									<div class="fr fontblack mt25 mb20 mr20">
										每页条数：<a href="<%=request.getContextPath()%>/back/actBack/getWorks.do?pz=5&sort=${sort}&sort_v=${sort_v}&ployId=${ployId}"
											class="${pageSize == 5 ? 'fontpink' : ''}">5</a> | <a
											href="<%=request.getContextPath()%>/back/actBack/getWorks.do?pz=10&sort=${sort}&sort_v=${sort_v}&ployId=${ployId}"
											class="${pageSize == 10 ? 'fontpink' : ''}">10</a> | <a
											href="<%=request.getContextPath()%>/back/actBack/getWorks.do?pz=20&sort=${sort}&sort_v=${sort_v}&ployId=${ployId}"
											class="${pageSize == 20 ? 'fontpink' : ''}">20</a>
									</div>
									<div class="fr fontblack mt5 mb20 mr20">
										<jsp:include page="../template/commonPagination.jsp">
											<jsp:param name="url" value="getWorks.do?sort=${sort}&sort_v=${sort_v}&ployId=${ployId}&"></jsp:param>
										</jsp:include>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="clear"></div>
		</div>

	</div>
	
 <script type="text/javascript">
	 $("#table tr").on("click", "th:eq(7)", function(e) {
		 var sort_v = $(this).attr("data-sort_v");
		 if(sort_v == 'DESC'){
			 sort_v='ASC';
		 }else {
			 sort_v='DESC';
		 }
		 $(this).attr("data-sort_v",sort_v);
		 window.location= "<%=request.getContextPath()%>/back/actBack/getWorks.do?sort=goodsCount&sort_v="+sort_v+"&ployId=${ployId}";

	 });
	     $("#table tr").on("click", "td:eq(8) input:eq(0)", function(e) {
	        closeOtherJDialog();
	        e.stopPropagation();
	        var dialog =  $("#update_manager_dialog");
	         dialog.dialog("open");
              var tr = $(this).parent().parent();
		      tr.data("tdArr", ["td:eq(9)","td:eq(1)","td:eq(11)","td:eq(6)","td:eq(7)","td:eq(12)","td:eq(13)","td:eq(10)"]);
		      tr.data("inputArr", ["input:eq(0)","input:eq(1)","textarea:eq(0)","input:eq(2)","input:eq(3)","input:eq(4)","input:eq(5)","select:eq(0)"]);
		      for (var i = 0, length = tr.data("tdArr").length; i < length; i++) {
		       $(tr.data("inputArr")[i], dialog).val($.trim($(tr.data("tdArr")[i], tr).text()));
		 }
   
	     });
	 
	 function activitySearch() {
			var ployId = $('#select-activityId').val();
		 window.location= "<%=request.getContextPath()%>/back/actBack/getWorks.do?sort=goodsCount&sort_v=${sort_v}&ployId="+ployId;

	 }
	          
  </script> 
		<!-- 添加活动信息 -->
		<div id="add_manager_dialog" title="添加活动信息" style="display:none;">
		<div class="box span10 oh">
			<table class="list_table"  id="tb_version_update" >
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;活动名称:</td>
					<td>
					<input type="text" id="iployname" name="iphone"
										class="input-text_popup_form" style="width:300px" maxlength="50"
										>
										
										</td>
				</tr>
	            <tr class="tr">
					<td align="left">&nbsp;&nbsp;活动描述:</td>
					<td><textarea   id="iployDesc" class="input-text_popup_form pl10 ml10"
						style="height:100px;width:90%;"></textarea></td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;活动开始时间:</td>
					<td> 
					<input type="text" onclick="WdatePicker();" id="istartTime" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'toDateInput\')}', minDate:'#F{$dp.$D(\'toDateInput\',{M:-2})}'})"
										class="Wdate" style="width:150px;padding-left:3px;"
										name="istartTime" />
					</td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;活动结束时间:</td>
					<td>
					<input type="text" onclick="WdatePicker();" id="iendTime" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'toDateInput\')}', minDate:'#F{$dp.$D(\'toDateInput\',{M:-2})}'})"
										class="Wdate" style="width:150px;padding-left:3px;"
										name="iendTime" />
                    </td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;活动图片:</td>
					<td>
					<div>
							<input type="file" name="fileName" class="ml10" style="height:36px;" id="file_upload" /> 
							<input id="uploadButton" type="button"
								onclick="$('#file_upload').uploadify('upload');" value="开始上传"
								class="ext_btn ext_btn_success" style="display:none;">
							<p class="fontpink" id="onlyOneImg" style="display:none;">只能上传一张图片</p>
							<input type="hidden" id="iphoto"   />
							<input type="hidden" id="iifUpPic"   value="0" />
							</div>
                    </td>
				</tr>
				
				 
			</table>
		</div>
		</div>
		<!-- 修改活动信息 -->
		<div id="update_manager_dialog" title="更新活动信息" style="display:none;">
		<div class="box span10 oh">
		<input type="hidden" id="uployid"   />
			<table class="list_table"  id="tb_version_update" >
				<tr class="tr">
				    
					<td align="left">&nbsp;&nbsp;活动名称:</td>
					<td>
					<input type="text" id="uployname" name="uphone"
										class="input-text_popup_form" style="width:300px" maxlength="50"
										>
										
										</td>
				</tr>
	            <tr class="tr">
					<td align="left">&nbsp;&nbsp;活动描述:</td>
					<td><textarea   id="uployDesc" class="input-text_popup_form pl10 ml10"
						style="height:100px;width:90%;"></textarea></td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;活动开始时间:</td>
					<td> 
					<input type="text" onclick="WdatePicker();" id="ustartTime" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'toDateInput\')}', minDate:'#F{$dp.$D(\'toDateInput\',{M:-2})}'})"
										class="Wdate" style="width:150px;padding-left:3px;"
										name="ustartTime" />
					</td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;活动结束时间:</td>
					<td>
					<input type="text" onclick="WdatePicker();" id="uendTime" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'toDateInput\')}', minDate:'#F{$dp.$D(\'toDateInput\',{M:-2})}'})"
										class="Wdate" style="width:150px;padding-left:3px;"
										name="uendTime" />
                    </td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;状态:</td>
					<td><select id="ustatus" name="ustatus" class="select pd10">
					<option value="0">无效</option>
					<option value="1">有效</option>
					</select>
				</td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;活动图片:</td>
					<td>
					<div>
					<input type="hidden" id="uphoto"   />
					<input type="hidden" id="uploypic"   />
							<input type="file" name="fileName" class="ml10" style="height:36px;" id="ufile_upload" /> 
							<input id="uuploadButton" type="button"
								onclick="$('#ufile_upload').uploadify('upload');" value="开始上传"
								class="ext_btn ext_btn_success" style="display:none;">
							<p class="fontpink" id="uonlyOneImg" style="display:none;">只能上传一张图片</p>
							<input type="hidden" id="uifUpPic"   value="0" />
							</div>
                    </td>
				</tr>
				
				 
			</table>
		</div>
		</div>
</body>

</html>
